﻿IF EXISTS (SELECT * FROM sysobjects WHERE type = 'P' AND name = 'usp_UPDMS_USR_TODO_Get_TODO_Count')
	BEGIN
		DROP  Procedure dbo.usp_UPDMS_USR_TODO_Get_TODO_Count
	END
GO

SET ANSI_NULLS ON
SET QUOTED_IDENTIFIER ON
GO
/******************************************************************************
**	Name : usp_UPDMS_USR_TODO_Get_TODO_Count
**	Desc : 사용자별 TO-DO의 카운트를 조회한다.
**	Test Exec Query : Exec usp_UPDMS_USR_TODO_Get_TODO_Count 'smstyle'
**	Called by : Usr_Dac_UPDMS_USR_TODO.cs
**	Program ID : Top.ascx
**	Auth : 송시명
**	Date : 2013-06-11
*******************************************************************************
**	Change History
*******************************************************************************
**	Date:		Author:		Description:
**	--------	--------	---------------------------------------
**			 
*******************************************************************************/
CREATE PROC [dbo].[usp_UPDMS_USR_TODO_Get_TODO_Count]
@ls_user_id nvarchar(40)
AS
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED
SET NOCOUNT ON

SELECT COUNT(Seq) AS Todo_Count
  FROM UPDMS_USR_TODO WITH(NOLOCK)
 WHERE Assign_Id = @ls_user_id
   AND Assign_St_Dt <= GETDATE()
   AND Status_Cd IN ('AB001', 'AB002') --진행중, 보류

GO